/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package wikitrafic.iovanalex.ro;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Properties;

/**
 *
 * @author Administrator
 */
public class ConfUtil {

    private Properties properties = new Properties();
    private String propFile="wikitrafic.properties";

    public ConfUtil(String propF) {
        propFile=propF;
        try {
            properties.load(new FileInputStream(propFile));
//            properties.loadFromXML(new FileInputStream(propFile));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public String getProperty(String prop) {
        return properties.getProperty(prop);
    }
    public void setProperty(String prop, String value) {
        properties.setProperty(prop, value);
        this.store();
    }

    public void store(){
        // Write properties file.
    try {
        properties.store(new FileOutputStream(propFile), null);
//        properties.storeToXML(new FileOutputStream(propFile), propFile);
    } catch (Exception e) {
    }

    }
}
